package cn.stylefeng.guns.modular.form.service;

import cn.stylefeng.guns.base.db.context.DataSourceContext;
import cn.stylefeng.guns.config.datasource.SqlSessionFactoryConfig;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class TestDemo {
    public static void main(String[] args) {
        SqlSessionFactoryConfig session = new SqlSessionFactoryConfig();
        DataSourceContext dataSourceContext = new DataSourceContext() ;


        try {
            Connection conn  = TestDemo.getDBC();
            System.out.println(conn.toString());

        } catch (Exception e) {
            e.printStackTrace();
        }


    }
    public static Connection getDBC() throws SQLException, Exception {
        String url = "jdbc:mysql://127.0.0.1:3306/guns?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=CTT";
        Class.forName("com.mysql.cj.jdbc.Driver");//Java DataBase Connectivitys是由sun microsystem提供的api
        Connection conn = DriverManager.getConnection(url, "root", "123456");
        return conn;
    }
}
